﻿<UserControl x:Class="MissedMemo.MeatAndCheeseDisc.OrderEntry.viewAddEditPizza"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:MissedMemo.MeatAndCheeseDisc.OrderEntry"
    Width="auto" Height="auto"
    MinWidth="300" MinHeight="300">

    <UserControl.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="resAddEditStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>
            
            <local:SelectionStateToBoolConverter x:Key="SelectionStateToBoolConverter" />
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />

        </ResourceDictionary>
    </UserControl.Resources>


    <Grid Style="{StaticResource AddEditViewContentStyle }" >
        
        <Grid.RowDefinitions>
            <RowDefinition Height="24" />
            <RowDefinition Height="32" />
            <RowDefinition Height="32" />
            <RowDefinition Height="12" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        

        <Image Grid.Row="0" Grid.RowSpan="3" Grid.Column="0" Source="Resources\Pizza.png" Height="100" />
        
        <TextBlock Grid.Row="1" Grid.Column="1" Text="Pizza Type:" VerticalAlignment="Center" Margin="24,0,5,0" />
        <ComboBox Grid.Row="1"  Grid.Column="2" Name="comboPizzaType" Width="150" SelectionChanged="comboPizzaTypeOrSize_SelectionChanged"
                  VerticalAlignment="Center" HorizontalAlignment="Left" SelectedItem="{Binding Type}"  />
        
        <TextBlock Grid.Row="2" Grid.Column="1" Text="Pizza Size:" VerticalAlignment="Center" Margin="24,0,5,0" />
        <ComboBox  Grid.Row="2" Grid.Column="2" Name="comboPizzaSize" Width="150" SelectionChanged="comboPizzaTypeOrSize_SelectionChanged"
                   VerticalAlignment="Center" HorizontalAlignment="Left" SelectedItem="{Binding Size}" />

        
        <!-- Customized Pizza Ingredients and Information -->
        
        <Grid Grid.Row="4" Grid.ColumnSpan="3" Margin="0,4,0,0" >
                
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition Width="36" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            
            <TextBlock Grid.Column="0" Text="Available Options:" HorizontalAlignment="Left" Margin="0,3" />
            <TextBlock Grid.Column="2" Text="Apply:" HorizontalAlignment="Left" Margin="0,3" />
            
            <ListBox Grid.Row="1" Grid.Column="0" Name="listOptionsAvailable" Padding="5" Background="Transparent"
                     Foreground="{StaticResource brushAddEditTextSubdued}" BorderBrush="{StaticResource brushAddEditViewBorderFaded}"
                     ScrollViewer.HorizontalScrollBarVisibility="Disabled" />
            
            <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" >
                <Button Name="btnAddOption" Content="&gt;" Width="24" Click="btnAddOption_Click"
                        IsEnabled="{Binding ElementName=listOptionsAvailable, Path=SelectedItem, Converter={StaticResource SelectionStateToBoolConverter}}" />
                <Button Name="btnRemoveOption" Content="&lt;" Width="24" Margin="0,5" Click="btnRemoveOption_Click"
                        IsEnabled="{Binding ElementName=listOptionsApplied, Path=SelectedItem, Converter={StaticResource SelectionStateToBoolConverter}}" />
            </StackPanel>
            
            <ListBox Grid.Row="1" Grid.Column="2" Name="listOptionsApplied" ItemsSource="{Binding Options}" Padding="5"
                     Background="{StaticResource brushAddEditViewBackround}" BorderBrush="{StaticResource brushAddEditViewBorder}" />
            
            <!-- Simple "Watermark" TextBox (containing prompt to aid user)... -->
            
            <Grid Grid.Row="2" Grid.ColumnSpan="3" Margin="0,14,0,0" Background="{StaticResource brushAddEditViewBackround}" >
                <TextBlock Margin="5,2" Text="Enter any special instructions..." Foreground="{StaticResource brushAddEditTextLight}"
                 Visibility="{Binding ElementName=txtSpecialInstructions, Path=Text.IsEmpty, Converter={StaticResource BooleanToVisibilityConverter}}" />
                <TextBox Name="txtSpecialInstructions" Text="{Binding SpecialInstructions}"
                         Background="Transparent" BorderBrush="{StaticResource brushAddEditViewBorderFaded}" />
            </Grid>
            
        </Grid>
        
    </Grid>

</UserControl>
